import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:getwidget/getwidget.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/route/route.dart';
import 'package:meal/ui/draw_under_line.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

class CategoryApply extends StatefulWidget {
  const CategoryApply({Key? key}) : super(key: key);

  @override
  State<CategoryApply> createState() => _CategoryApplyState();
}

class _CategoryApplyState extends State<CategoryApply> {
  Widget get actions {
    return BrnTextAction(
      '开店帮助',
      iconPressed: onHelp,
      themeData: BrnAppBarConfig(
          actionsStyle: BrnTextStyle(
              color: Colors.white, fontSize: Sizes.default16, fontWeight: FontWeight.normal)),
    );
  }

  onHelp() {
    Get.toNamed(RouteGet.storeHelp);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ToolsUtils.getDefaultBackgroundColor(),
      appBar: ToolsUtils.getDefaultBrnAppBar('申请记录', actions: actions),
      body: SizedBox(
        height: double.maxFinite,
        child: Column(
          children: [
            Container(
              margin: const EdgeInsets.all(Sizes.default10),
              padding: const EdgeInsets.symmetric(vertical: Sizes.default10),
              decoration: const BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.all(Radius.circular(Sizes.default10))),
              child: Column(
                children: [
                  Container(
                    padding: const EdgeInsets.symmetric(horizontal: Sizes.default10),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        ToolsUtils.getUrlSvg(
                            'https://cdn7.axureshop.com/demo/1525603/images/4_5申请记录/u727.svg',
                            width: 22,
                            height: 22),
                        Expanded(
                            child: Container(
                          padding: const EdgeInsets.symmetric(horizontal: Sizes.default10),
                          child: Column(
                            children: [
                              Container(
                                alignment: Alignment.centerLeft,
                                child: Text(
                                  '默林如斯的广东肠粉早餐店(凤凰广场店)',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: Sizes.default15, color: ColorsUtils.color333),
                                ),
                              ),
                              Container(
                                margin: const EdgeInsets.only(top: Sizes.default8),
                                alignment: Alignment.centerLeft,
                                child: Text(
                                  '+86 135987200',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color797, fontSize: Sizes.default13),
                                ),
                              ),
                              Container(
                                height: 2,
                                margin: const EdgeInsets.only(top: Sizes.default15),
                                child: DrawUnderLine(
                                  color: ColorsUtils.rgba(217, 217, 217),
                                  child: Container(),
                                ),
                              ),
                            ],
                          ),
                        )),
                        Container(
                          alignment: Alignment.center,
                          child: GestureDetector(
                            onTap: () {
                              Get.toNamed(RouteGet.storeApply);
                            },
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                  text: '详情',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: Sizes.default13, color: ColorsUtils.color006)),
                              WidgetSpan(
                                  child:
                                  BrunoTools.getAssetSizeImage(BrnAsset.iconRightArrow, 15, 15),
                                  alignment: PlaceholderAlignment.middle)
                            ])),
                          ),
                        ),
                      ],
                    ),
                  ),
                  Container(
                    padding: const EdgeInsets.symmetric(horizontal: Sizes.default30),
                    child: Column(
                      children: [
                        Container(
                          height: Sizes.default40,
                          alignment: Alignment.centerLeft,
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Text('审核状态',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: Sizes.default13, color: ColorsUtils.color797)),
                              Text('未处理',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: Sizes.default16, color: ColorsUtils.colorFf6)),
                            ],
                          ),
                        ),
                        Container(
                          height: Sizes.default40,
                          alignment: Alignment.centerLeft,
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Text('店铺类型',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: Sizes.default13, color: ColorsUtils.color797)),
                              Text('餐饮店铺',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: Sizes.default13, color: ColorsUtils.color333)),
                            ],
                          ),
                        ),
                        Container(
                          height: Sizes.default40,
                          alignment: Alignment.centerLeft,
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Text('经营品类',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: Sizes.default13, color: ColorsUtils.color797)),
                              Text('主:肠粉/辅:茶饮',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: Sizes.default13, color: ColorsUtils.color333)),
                            ],
                          ),
                        ),
                        Container(
                          height: Sizes.default40,
                          alignment: Alignment.centerLeft,
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Text('申请时间',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: Sizes.default13, color: ColorsUtils.color797)),
                              Text('2021-09-07 14:58:35',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: Sizes.default13, color: ColorsUtils.color333)),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                  Container(
                    alignment: Alignment.centerRight,
                    child: SizedBox(
                      width: Sizes.default100,
                      height: Sizes.default30,
                      child: GFButton(
                        onPressed: () {
                          Get.toNamed(RouteGet.storeContract);
                        },
                        text: '签订合同',
                        textStyle: StylesUtils.customTextStyle(
                            fontSize: Sizes.default16, color: ColorsUtils.colorFf6),
                        shape: GFButtonShape.pills,
                        type: GFButtonType.solid,
                        size: GFSize.SMALL,
                        color: Colors.white,
                        borderSide: BorderSide(color: ColorsUtils.rgba(255, 110, 83, 1)),
                      ),
                    ),
                  )
                ],
              ),
            ),
          ],
        ),
      ),
      bottomNavigationBar: SafeArea(
        top: false,
        child: Container(
            height: Sizes.default60,
            alignment: Alignment.topCenter,
            padding: const EdgeInsets.symmetric(vertical: Sizes.default10),
            decoration: const BoxDecoration(color: Colors.white),
            child: SizedBox(
              height: Sizes.default40,
              child: FractionallySizedBox(
                widthFactor: 0.9,
                child: GFButton(
                    onPressed: () {
                      Get.toNamed(RouteGet.storeFlow);
                    },
                    text: '新建店铺',
                    textStyle: StylesUtils.customTextStyle(fontSize: Sizes.default16),
                    shape: GFButtonShape.pills,
                    type: GFButtonType.solid,
                    size: GFSize.LARGE,
                    color: ColorsUtils.parseColorFromHexString(ColorsUtils.colorFf6)),
              ),
            )),
      ),
    );
  }
}
